package com.neusoft.neuiotms.dcom.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;

import org.hibernate.validator.constraints.Length;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.neusoft.bizcore.web.jpa.model.AbstractAuditModel;
import com.neusoft.bizcore.web.jpa.model.Comment;
import com.neusoft.neuiotms.dcom.model.enums.StopServiceNoticeSendStatusEnum;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
@Table(name = "neuiot_stop_service_notice")
@org.hibernate.annotations.Table(appliesTo = "neuiot_stop_service_notice", comment = "停止服务通知表")
public class StopServiceNotice extends AbstractAuditModel {

    private static final long serialVersionUID = 1L;

    @Length(max = 50, message = "停止服务编码不能超过{max}位")
    @Column(length = 50, nullable = false)
    @Comment("varchar(50) NOT NULL COMMENT '停止服务编码'")
    private String code;

    @NotBlank(message = "停止服务名称")
    @Length(max = 100, message = "名称不能超过{max}位")
    @Column(length = 100, nullable = false)
    @Comment("varchar(100) NOT NULL COMMENT '任务名称'")
    private String name;

    @Column(nullable = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Comment("datetime NULL DEFAULT COMMENT '服务停止时间'")
    private Date stopTime;

    @NotBlank(message = "部门编码")
    @Length(max = 50, message = "部门编码不能超过{max}位")
    @Column(length = 50, nullable = false)
    @Comment("varchar(50) NOT NULL COMMENT '部门编码'")
    private String orgCode;

    @Length(max = 100, message = "部门名称不能超过{max}位")
    @Column(length = 100, nullable = true)
    @Comment("varchar(100) NOT NULL COMMENT '部门名称'")
    private String orgName;

    @Length(max = 100, message = "地点不能超过{max}位")
    @Column(length = 100, nullable = true)
    @Comment("varchar(100) NOT NULL COMMENT '地点'")
    private String location;

    @Lob
    @Column(columnDefinition = "text")
    @Comment("text COMMENT '通知人")
    private String jsonUsers;

    @Column(nullable = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Comment("datetime NULL DEFAULT COMMENT '开始时间'")
    private Date startDateTime;

    @Column(nullable = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Comment("datetime NULL DEFAULT COMMENT '结束时间'")
    private Date endDateTime;

    @NotBlank(message = "通知方式")
    @Length(max = 100, message = "通知方式不能超过{max}位")
    @Column(length = 100, nullable = false)
    @Comment("varchar(100) NOT NULL COMMENT '通知方式'")
    private String noticeType;

    @Enumerated(EnumType.STRING)
    @Column(length = 25, nullable = true)
    @Comment("varchar(25) NOT NULL COMMENT '通知发送任务状态'")
    private StopServiceNoticeSendStatusEnum status;

    @Lob
    @Column(columnDefinition = "longtext")
    @Comment("text COMMENT '维护内容")
    private String content;

    @Lob
    @Column(columnDefinition = "longtext")
    @Comment("text COMMENT '影响及保障措施")
    private String impactSafeguard;

    @Length(max = 500, message = "其他影响情况")
    @Column(length = 500, nullable = false)
    @Comment("varchar(500) NULL COMMENT '其他影响情况'")
    private String others;

    @Comment("BIGINT NOT NULL COMMENT '申请人编码'")
    private Long userId;

    @Length(max = 100, message = "申请人名称不能超过{max}位")
    @Column(length = 100, nullable = true)
    @Comment("varchar(100) NULL COMMENT '申请人名称'")
    private String userName;

    @Length(max = 100, message = "维护类别Code不能超过{max}位")
    @Column(length = 100, nullable = false)
    @Comment("varchar(100) NULL COMMENT '维护类别Code'")
    private String modelCode;

    @Length(max = 100, message = "维护类别名称不能超过{max}位")
    @Column(length = 100, nullable = true)
    @Comment("varchar(100) NULL COMMENT '维护类别名称'")
    private String modelName;

    @Lob
    @Column(columnDefinition = "longtext")
    @Comment("text COMMENT '对象集合'")
    private String jsonObjs;
}
